<hr />

<%= link_to_remote 'Edit', :url => edit_disc_path(disc.id), :method => :get %> |
<%= link_to 'Delete', new_delete_request_path(:editable_id => disc.id,
                                              :editable_type => "Disc"),
                      :class => 'lightwindow',
                      :params => 'lightwindow_type=page,lightwindow_width=500,lightwindow_height=500' %>

<p>
  <% disc.number %>
  <%=h (disc.format.blank?)? "" : disc.format + " " + disc.number.to_s %>
  <%=h (disc.title.blank?)? "" : " : " + disc.title %>
</p>

<table>
  <tr>
    <th>Track</th>
	<th>Artists</th>
	<th>Name</th>
	<th>Length</th>
  </tr>
  
  <% disc.songs.each do |song| %>
    <tr>
	  <td><%=h song.track %></td>
	  <td>
	    <% song.artists.each do |artist| %>
		  <%= link_to artist.name, artist %>
		  | <%= link_to 'x', remove_song_artist_links_path(song, :artist_id => artist.id), :method => :delete %>
		  <%=h (artist == song.artists.last) ? "" : "&" %>
		<% end %>
		<br />
		<%= link_to 'Add Artist', new_song_artist_link_path(song),
                                  :class => 'lightwindow',
                                  :params => 'lightwindow_type=page,lightwindow_width=500,lightwindow_height=500' %>
	  </td>
	  <td><%= link_to song.title, song %></td>
	  <td><%=h song.length_in_mins %></td>
	</tr>
	
	<tr>
	  <td class="song-table-credit" colspan="3">
		  
        <% song.song_credits.each do |credit| %>
	      <%= render :partial => 'song_credits/song_credit', :locals => {:credit => credit} %>
	    <% end %>
			
        <%= link_to 'Add Credit', new_song_song_credit_path(song),
                                  :class => 'lightwindow',
		   					      :params => 'lightwindow_type=page,lightwindow_width=500,lightwindow_height=500' %>
      </td>
	</tr>
  <% end %>

</table>